<?php

namespace App\Http\Controllers\Admin;

use App\Service\Admin\DataService;
use Illuminate\Http\Request;
use App\Service\Admin\MenuService;
use Illuminate\Support\Facades\Cache;

class IndexController extends AdminBaseController
{
    public function index(Request $request,MenuService $menuService){
        $menu_list = $menuService->getRoleMenuList();

        $data['menu_list'] = $menu_list;
        return view('admin/index/index',['data'=>$data]);
    }

    /**
     * @author fld 2021-07-16
     * @desc 获取欢迎页数据
     * @param Request $request
     * @param DataService $dataService
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function welcome(Request $request,DataService $dataService){
        $data = $dataService->getWelcomeData();
        return view('admin/index/welcome',['data'=>$data]);
    }
    /**
     * @author fld 2021-08-27
     * @desc 清空缓存
     * @param Request $request
     */
    public function clear_cache(Request $request){
        Cache::flush();
        echo '清空缓存成功';
    }
}
